package cn.tedu.csmall.product.schedule;

import cn.tedu.csmall.product.service.IAlbumService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class CacheSchedule {

    @Autowired
    private IAlbumService albumService;

    public CacheSchedule() {
        log.debug("创建处理缓存的计划任务类对象：CacheSchedule");
    }

    @Scheduled(fixedRate = 3 * 60 * 1000)
    public void rebuildCache(){
        log.debug("执行了计划任务...");

        albumService.rebuildCache();
    }
}
